It is common for a host computer to archive data on a linear tape storage device or medium. The characteristics of linear tape storage devices generally require that data be provided at a fixed rate that is related to the linear speed of the tape medium itself. In most cases, electronic interface logic is associated with a tape drive in order to accept data at a rate more convenient for the host computer, and to then format the data appropriately for the tape writing mechanisms. In addition, the interface logic processes the data in various way, such as by compressing the data.
It is conventional for the host computer to break data into relatively large data blocks, and to provide such data blocks as integral packages of data to the tape drive interface logic. This is done for the sake of efficiency. Rather than making intermittent small data transfers at a rate set by the tape device, the host computer is allowed to make larger block transfers at less frequent intervals but at higher data rates, thereby freeing the intervening time for other tasks. Block size is normally established by the host computer. The primary purpose of the interface logic is to buffer the data blocks as they are received, to process the data blocks (such as by compressing them), and to write the resulting data block elements to the tape medium at the rate required by the tape medium.
The interface logic normally includes a memory buffer for incoming data. The buffer is used to synchronize data transfers from the host computer to the tape drive. By using a buffer, the interface logic can accept blocks of data at high data rates from the host computer, and then write the data to the tape device at the slower rate required by the tape device.
Before accepting a data block from the host computer, the interface logic determines whether there is enough buffer memory to hold the data block. However, because of compression and other processing performed by the interface logic, it is often difficult to determine the amount of buffer space that will be needed for a particular data block after it has been processed. When beginning a block transfer, the host computer indicates the size of the unprocessed block. However, complex calculations might be required to determine the size of the block after processing. There are known ways to overcome this problem.
One way is to actually calculate the size of the processed data, based on the size of the incoming unprocessed data block, prior to allowing the block transfer to begin. The disadvantage of this method is that it requires complex software algorithms or expensive custom hardware to perform the calculations.
Another way is to conservatively approximate the size of the processed data, avoiding the complex calculations noted above. This method, however, tends to waste buffer memory due to the conservative nature of the approximations.
A third way is to use two memory buffers. Incoming blocks are stored, without processing, in a first buffer. Once a block is stored in the first buffer, it is processed and written to a second buffer, prior to writing to the tape itself. This method has the obvious disadvantage of requiring much more memory than the previous two methods.